*------------------------------------------TRUST AND COMPETENCE EVALAUTIONS ANES --------------------------------------------------------------*

*--------------------------------- ROBUSTNESS TEST S.I.5: Difference score approach ----------------------------------------------------------*
*                             All results are reported in Supplementary Material S.5                                                      *


****** Excludes data that does not contain simultaneous trait ratings of power and warmth of presidential candidates
drop if VCF0004 < 1984
drop if VCF0004 == 1986
drop if VCF0004 == 1990
drop if VCF0004 == 1994
drop if VCF0004 == 1998
drop if VCF0004 == 2002
drop if VCF0004 == 2012


**************************************************RECODES DIFFERENT VARIABLES**************************************************************



*****Trait perceptions of political candidates - coded to 0-1 scales with "0" and "1" constituting min. and max vaklues, respectively. 
*Republican candidates are coded "1" and Democrats are coded "2"
// Categories for trait variables:
*1. Extremely well
*2. Quite well
*3. Not too well
*4. Not well at all

*Missing codes:
*8: DK
*9: NA
*0:


*** Trait: Strong leadership
recode VCF0368 (1=4) (2=3) (3=2) (4=1) (0 = .) (8 =.) (9 =.), generate(Lead_REP)
recode VCF0356 (1=4) (2=3) (3=2) (4=1) (0 = .) (8 =.) (9 =.), generate(Lead_DEM)

*** Trait: 'Really cares about people like you'
recode VCF0369 (1=4) (2=3) (3=2) (4=1) (0 = .) (8 =.) (9 =.), generate(Care_REP)
recode VCF0357 (1=4) (2=3) (3=2) (4=1) (0 = .) (8 =.) (9 =.), generate(Care_DEM)

*** Trait: Compassionate
recode VCF0363 (1=4) (2=3) (3=2) (4=1) (0 = .) (8 =.) (9 =.), generate(Comp_REP)
recode VCF0351 (1=4) (2=3) (3=2) (4=1) (0 = .) (8 =.) (9 =.), generate(Comp_DEM)

*** Trait: Moral
recode VCF0367 (1=4) (2=3) (3=2) (4=1) (0 = .) (8 =.) (9 =.), generate(Integrity_REP)
recode VCF0355 (1=4) (2=3) (3=2) (4=1) (0 = .) (8 =.) (9 =.), generate(Integrity_DEM)

*** Trait: Intelligent
recode VCF0362 (1=4) (2=3) (3=2) (4=1) (0 = .) (8 =.) (9 =.), generate(Intel_REP)
recode VCF0350 (1=4) (2=3) (3=2) (4=1) (0 = .) (8 =.) (9 =.), generate(Intel_DEM)

*** Trait: Decent
recode VCF0364 (1=4) (2=3) (3=2) (4=1) (0 = .) (8 =.) (9 =.), generate(Decent_REP)
recode VCF0352 (1=4) (2=3) (3=2) (4=1) (0 = .) (8 =.) (9 =.), generate(Decent_DEM)

*** Trait: Inspiring
recode VCF0365 (1=4) (2=3) (3=2) (4=1) (0 = .) (8 =.) (9 =.), generate(Inspir_REP)
recode VCF0353 (1=4) (2=3) (3=2) (4=1) (0 = .) (8 =.) (9 =.), generate(Inspir_DEM)

*** Trait: Knowledgeable
recode VCF0366 (1=4) (2=3) (3=2) (4=1) (0 = .) (8 =.) (9 =.), generate(Know_REP)
recode VCF0354 (1=4) (2=3) (3=2) (4=1) (0 = .) (8 =.) (9 =.), generate(Know_DEM)


*** Creates common WARMTH variable based on 'Really cares about people like you' and Compassion
egen Warmth_REP = rowmean(Care_REP Comp_REP)
egen Warmth_DEM = rowmean(Care_DEM Comp_DEM)

*** Creates common COMPETENCE variable based on intelligent and knowledgeable
egen Competence_REP = rowmean(Intel_REP Know_REP)
egen Competence_DEM = rowmean(Intel_DEM Know_DEM)



*****Dependent Variables:

*** Vote choice
*VALID_CODES:
*------------
*1. Democrat
*2. Republican
*3. Major third party candidate (Wallace 1968/Anderson 1980/Perot 1992,1996)

*Omkodning:
recode VCF0704 (0 3 =.), generate(vote_choice)

*Sandsynlighed for at stemme på Democrats:
recode vote_choice (1=1) (2 = 0), generate(vote_DEM)

*Sandsynlighed for at stemme på Republicans:
recode vote_choice (1 = 0) (2=1), generate(vote_REP)


*** Feeling themometer ratings

** Feeling thermometer rating of Republican candidate:
recode VCF0426 (98 =.) (99=.), generate(feel_REP)

** Feeling thermometer rating of Democratic candidate:
recode VCF0424 (98 =.) (99=.), generate(feel_DEM)




*********************************** Difference score variables: Score for Democratic cand. - Score for Republican cand.*****************************

*Strong Leadership:
generate Leadership_diff = (Lead_DEM-Lead_REP)/3

*Warmth:
generate Warmth_diff = (Warmth_DEM-Warmth_REP)/3

*Moral:
generate Integrity_diff = (Integrity_DEM-Integrity_REP)/3

*Competence:
generate Competence_diff = (Competence_DEM-Competence_REP)/3


*Feeling thermometer:
generate feel_diff = (feel_DEM - feel_REP)/100




******************************************** BACKGROUND VARIABLES AND CONTROLS ************************************************************

****** BACKGROUND VARIABLES AND CONTROLS
**** Respondents' party identification (7-point scale recoded to 0-1 scale format;
* "0" and "1" represents "Strong Democrats" and "Strong Republicans", respectively.
recode VCF0301  (1 = 1) (2 = 2) (3 = 3) (4 = 4) (5 = 5) (6 =6) (7=7) (else =.), generate(party_7)
generate party7 = (party_7-1)/6


**** Respondents' ideological self-placement on 7-point scale (1 = Extremely liberal; 7 = Extremely conservative)
recode VCF0803 (0 9 =.), generate(libcons7)
generate ideology = (libcons7-1)/6

**** Gender: VCF0104
recode VCF0104 (1=1 "male") (2=0 "female") (else =.), generate(gender) label(genderLB)

**** Age: VCF0101
recode VCF0101 (00 97 98 99 = .), generate(age)

**** Income: summary household income - VCF0114 
//coded in percentiles: 0-16; 17-33; 34-67 68-95; 96-100.
recode VCF0114 (1=0) (2=1) (3=2) (4=3) (5=4) (0=.), generate(income)

**** Education: VCF0110
//coded in four categories
recode VCF0110 (1=0) (2=1) (3=2) (4=3) (0=.), generate(education)

**** Race: VCF0106
//coded 1 = white, 0 = nonwhite
recode VCF0106 (1=1) (2 3 = 0) (0 9 =.), generate(race)

**** Church attendance: VCF0130
// coded into five continuous categories
recode VCF0130 (5 7 = 0) (4 = 1) (3 = 2) (2 = 3) (1 = 4) (0 8 9 =.), generate(church)





********************************************  ANALYSES BASED ON DIFFERENCE SCORES ***********************************************
*1) Predicting feeling thermometer ratings based on difference scores (reported in Table S.4.1, Model A)
reg feel_diff c.Competence_diff c.Warmth_diff c.Leadership_diff c.Integrity_diff c.party7 c.ideology i.gender c.age c.income c.education i.race c.church ib(2008).VCF0004
test Warmth_diff = Competence_diff
test Warmth_diff = Leadership_diff
test Warmth_diff = Integrity_diff


*Graphical illustration: Figure S.4.1. Panel a
margins, dydx(Competence_diff Warmth_diff Leadership_diff Integrity_diff)  level(95) noestimcheck 
marginsplot, recastci(rcap) ciopts(lpattern(dash)) recast(bar) yline(0) xlabel(#4) ylabel(0 (0.1) 0.5) ///
xtitle(trait evaluations) ytitle(Marginal effect of traits on feeling thermometer ratings) title("Panel A(feeling thermometer ratings)") scheme(s2color) ///
name(diffscore_feelingtherm, replace)

*2) Predicting vote choice based on difference scores (reported in Table S.4.1, Model B)
logit vote_DEM c.Competence_diff c.Warmth_diff c.Leadership_diff c.Integrity_diff c.party7 c.ideology i.gender c.age c.income c.education i.race c.church ib(2008).VCF0004
logit vote_DEM c.Competence_diff c.Warmth_diff c.Leadership_diff c.Integrity_diff c.party7 c.ideology i.gender c.age c.income c.education i.race c.church ib(2008).VCF0004, or
test Warmth_diff = Competence_diff
test Warmth_diff = Leadership_diff
test Warmth_diff = Integrity_diff


*Graphical illustration: Figure S.4.1 Panel B
margins, dydx(Competence_diff Warmth_diff Leadership_diff Integrity_diff)  level(95) noestimcheck 
marginsplot, recastci(rcap) ciopts(lpattern(dash)) recast(bar) yline(0) xlabel(#4) ylabel(0 (0.1) 0.5) ///
xtitle(trait evaluations) ytitle(Marginal effect of traits on vote choice) title("Panel B(vote choice)") scheme(s2color) ///
name(diffscore_votechoice, replace)

graph combine diffscore_feelingtherm diffscore_votechoice
